connect to the display's "closed" signal and free the cached scratch
authorMichael Natterer <mitch@imendio.com>
Thu, 12 Jan 2006 13:50:51 +0000 (13:50 +0000)
committerMichael Natterer <mitch@src.gnome.org>
Thu, 12 Jan 2006 13:50:51 +0000 (13:50 +0000)
2006-01-12  Michael Natterer  <mitch@imendio.com>

* gdk/gdkimage.c (scratch_image_info_for_depth): connect to the
display's "closed" signal and free the cached scratch images upon
display closing (bug #85715).

ChangeLog
ChangeLog.pre-2-10
gdk/gdkimage.c

index 5cae63ecb33fcbfad23e53c4f6b8f092c9a8e290..f2b9139a574a6b02639dd307f34d5d79684c69f9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-01-12  Michael Natterer  <mitch@imendio.com>
+
+       * gdk/gdkimage.c (scratch_image_info_for_depth): connect to the
+       display's "closed" signal and free the cached scratch images upon
+       display closing (bug #85715).
+
 2006-01-12  Michael Natterer  <mitch@imendio.com>
 
        * gtk/gtkexpander.c (gtk_expander_set_expanded): skip the
index 5cae63ecb33fcbfad23e53c4f6b8f092c9a8e290..f2b9139a574a6b02639dd307f34d5d79684c69f9 100644 (file)
@@ -1,3 +1,9 @@
+2006-01-12  Michael Natterer  <mitch@imendio.com>
+
+       * gdk/gdkimage.c (scratch_image_info_for_depth): connect to the
+       display's "closed" signal and free the cached scratch images upon
+       display closing (bug #85715).
+
 2006-01-12  Michael Natterer  <mitch@imendio.com>
 
        * gtk/gtkexpander.c (gtk_expander_set_expanded): skip the
index a2744261a231ae08a49c07bca99e53479b84200b..db47ebe36166fa2fd59871c79e7774138c2512ed 100644 (file)
@@ -226,6 +226,25 @@ allocate_scratch_images (GdkScratchImageInfo *info,
   return TRUE;
 }
 
+static void
+scratch_image_info_display_closed (GdkDisplay          *display,
+                                   gboolean             is_error,
+                                   GdkScratchImageInfo *image_info)
+{
+  gint i;
+
+  g_signal_handlers_disconnect_by_func (display,
+                                        scratch_image_info_display_closed,
+                                        image_info);
+
+  scratch_image_infos = g_slist_remove (scratch_image_infos, image_info);
+
+  for (i = 0; i < image_info->n_images; i++)
+    g_object_unref (image_info->static_image[i]);
+
+  g_free (image_info);
+}
+
 static GdkScratchImageInfo *
 scratch_image_info_for_depth (GdkScreen *screen,
                              gint       depth)
@@ -249,6 +268,10 @@ scratch_image_info_for_depth (GdkScreen *screen,
   image_info->depth = depth;
   image_info->screen = screen;
 
+  g_signal_connect (gdk_screen_get_display (screen), "closed",
+                    G_CALLBACK (scratch_image_info_display_closed),
+                    image_info);
+
   /* Try to allocate as few possible shared images */
   for (i=0; i < G_N_ELEMENTS (possible_n_images); i++)
     {